
#ifndef __SEARCH_PANEL_H__
#define __SEARCH_PANEL_H__

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gtksourceview/gtksourceview.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include "doc_panel_base.h"

G_BEGIN_DECLS


#define TYPE_SEARCH_PANEL (search_panel_get_type ())
#define SEARCH_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_PANEL, SearchPanel))
#define SEARCH_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_PANEL, SearchPanelClass))
#define IS_SEARCH_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_PANEL))
#define IS_SEARCH_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_PANEL))
#define SEARCH_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_PANEL, SearchPanelClass))

typedef struct _SearchPanel SearchPanel;
typedef struct _SearchPanelClass SearchPanelClass;
typedef struct _SearchPanelPrivate SearchPanelPrivate;

struct _SearchPanel {
	DocPanelBase parent_instance;
	SearchPanelPrivate * priv;
	GtkEntry* pharse_entry;
	GtkCheckButton* match_case_cbtn;
	GtkCheckButton* match_word_cbtn;
	GtkCheckButton* match_regex_cbtn;
	GList* founded;
	gint founded_pos;
};

struct _SearchPanelClass {
	DocPanelBaseClass parent_class;
	gboolean (*on_show_panel) (SearchPanel* self);
	gboolean (*on_close_panel) (SearchPanel* self);
	gboolean (*on_search) (SearchPanel* self, GtkEntry* sender, const GdkEventKey* event);
};


SearchPanel* search_panel_construct (GType object_type, GtkSourceBuffer** source_buff, GtkSourceView** source_view);
SearchPanel* search_panel_new (GtkSourceBuffer** source_buff, GtkSourceView** source_view);
void search_panel_on_option_toggled (SearchPanel* self);
gboolean search_panel_on_show_panel (SearchPanel* self);
gboolean search_panel_on_close_panel (SearchPanel* self);
void search_panel_on_pharse_entry_changed (SearchPanel* self);
gboolean search_panel_on_search (SearchPanel* self, GtkEntry* sender, const GdkEventKey* event);
void search_panel_goto_next_match (SearchPanel* self);
void search_panel_goto_prev_match (SearchPanel* self);
gboolean search_panel_get_match_case (SearchPanel* self);
void search_panel_set_match_case (SearchPanel* self, gboolean value);
gboolean search_panel_get_match_words (SearchPanel* self);
void search_panel_set_match_words (SearchPanel* self, gboolean value);
gboolean search_panel_get_match_regex (SearchPanel* self);
void search_panel_set_match_regex (SearchPanel* self, gboolean value);
const char* search_panel_get_search_pharse (SearchPanel* self);
void search_panel_set_search_pharse (SearchPanel* self, const char* value);
GType search_panel_get_type (void);


G_END_DECLS

#endif
